package com.njwb.day17.maipiao;

// 票类，封装票的数量和卖票操作
public class Ticket {
    private int count;

    public Ticket(int count) {
        this.count = count;
    }

    public synchronized boolean sellOne() {
        if (count > 0) {
            count--;
            return true;
        }
        return false;
    }


    public synchronized int getCount() {
        return count;
    }
}
